package wfm.entities;

import java.io.Serializable;

import javax.inject.Named;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="Address")
@Named
public class Address implements Serializable
{
	private static final long serialVersionUID = -3450110429324400066L;
	private String street = "";
	private String city = "";
	private String zip = "";
	private String country = "";
	
	public Address() {}
	public Address(String street, String city, String zip, String country)
	{
		this.street = street;
		this.city = city;
		this.zip = zip;
		this.country = country;
	}
	
	// Getter Methods
	public String getStreet() { return this.street; }
	public String getCity() { return this.city; }
	public String getZip() { return this.zip; }
	public String getCountry() { return this.country; }
	
	// Setter-Methods
	public void setStreet(String street) { this.street = street; }
	public void setCity(String city) { this.city = city; }
	public void setZip(String zip) { this.zip = zip; }
	public void setCountry(String country) { this.country = country; }
	
	public String toString()
	{
		return this.street+", "+this.zip+", "+this.city+", "+this.country;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((city == null) ? 0 : city.hashCode());
		result = prime * result + ((country == null) ? 0 : country.hashCode());
		result = prime * result + ((street == null) ? 0 : street.hashCode());
		result = prime * result + ((zip == null) ? 0 : zip.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Address other = (Address) obj;
		if (city == null) {
			if (other.city != null)
				return false;
		} else if (!city.equals(other.city))
			return false;
		if (country == null) {
			if (other.country != null)
				return false;
		} else if (!country.equals(other.country))
			return false;
		if (street == null) {
			if (other.street != null)
				return false;
		} else if (!street.equals(other.street))
			return false;
		if (zip == null) {
			if (other.zip != null)
				return false;
		} else if (!zip.equals(other.zip))
			return false;
		return true;
	}
}
